use chrono::{DateTime, Local, Months, NaiveDate, Utc};

fn main() {
    let utc: DateTime<Utc> = Utc::now(); // e.g. `2014-11-28T12:45:59.324310806Z`
    let local: DateTime<Local> = Local::now(); // e.g. `2014-11-28T21:45:59.324310806+09:00`

    println!("UTC: {} \n Local: {}", utc, local);

    // Get components
    let naive_utc = local.naive_utc();
    let offset = local.offset().clone();
    // Serialize, pass through FFI... and recreate the `DateTime`:
    let dt_new = DateTime::<Local>::from_naive_utc_and_offset(naive_utc, offset);

    println!(
        "naive_utc={}, offset={}, dt_new={}",
        naive_utc, offset, dt_new
    );

    // Moth
    let from_ymd = NaiveDate::from_ymd_opt(2024, 01, 09).unwrap();
    println!("新的日期 = {}", from_ymd + Months::new(41))
}
